<template>
	<view class="content">
		<!-- Banner Image -->
		<view class="image-container">
			<u-image :src="img" class="teacher-banner"></u-image>
		</view>

		<!-- Teacher Details -->
		<view class="details">
			<view class="teacher-header">
				<text class="teacher-name">{{teacherInfo.teacherName}}</text>
				<view class="teacher-tag">
					<text>{{teacherInfo.teacherType}}</text>
				</view>
			</view>

			<view class="info-grid">
				<view class="info-item">
					<u-icon name="phone" size="20" color="#666"></u-icon>
					<text class="info-label">{{teacher.title3}}</text>
					<text class="info-value">{{teacherInfo.teacherPhone}}</text>
				</view>
				
				<view class="info-item">
					<u-icon name="email" size="20" color="#666"></u-icon>
					<text class="info-label">{{teacher.title4}}</text>
					<text class="info-value">{{teacherInfo.teacherEmail}}</text>
				</view>
			</view>

			<!-- Introduction Section -->
			<view class="introduction-section">
				<view class="section-header">
					<u-icon name="info-circle" size="20" color="#666"></u-icon>
					<text class="section-title">{{teacher.title5}}</text>
				</view>
				<view class="introduction-content">
					<text class="introduction-text">{{teacherInfo.teacherIntroduction}}</text>
				</view>
			</view>

			<view class="action-buttons">
				<u-button type="primary" text="联系老师" size="large" shape="circle"></u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import {showTeacher} from '@/api/teacher.js'
	export default {
		data() {
			return {
				img:'',
				teacher:{
					title1:'教师名称',
					title2:'教师类型',
					title3:'教师联系电话',
					title4:'教师邮箱',
					title5:'教师简介',
				},
				teacherInfo:{
					teacherName:'钱老师',
					teacherType:'教授',
					teacherPhone:'18213372422',
					teacherEmail:'2223243@qq.com',
					teacherIntroduction:'xixixiixxixiix',
				}
			}
		},
		
		onLoad() {
			this.windowInfo = uni.getWindowInfo()
			this.getTeacherInfo()
		},
		
		methods: {
			getTeacherInfo(){
				const classId = 1
				const data ={
					classId: classId,
				}
				showTeacher(data).then(res =>{
					console.log(res,55555)
					this.teacherInfo = res.data.showTeacher
					this.img = res.data.showTeacher.url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.content {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	background-color: #f8f8f8;
}

.image-container {
	width: 100%;
	height: 50vh;
	max-height: 500rpx;
	min-height: 300rpx;
	position: relative;
	overflow: hidden;
	margin: 0;
	padding: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	margin-bottom: 30rpx;
	
	.teacher-banner {
		width: 100%;
		height: 100%;
		object-fit: cover;
		object-position: center;
	}
}

.details {
	padding: 30rpx;
	margin-top: -40rpx;
	background-color: #fff;
	border-radius: 40rpx 40rpx 0 0;
	box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
}

.teacher-header {
	margin-bottom: 40rpx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	
	.teacher-name {
		font-size: 40rpx;
		font-weight: bold;
		color: #333;
	}
	
	.teacher-tag {
		background-color: #e6f7ff;
		padding: 8rpx 24rpx;
		border-radius: 30rpx;
		
		text {
			font-size: 24rpx;
			color: #2979ff;
			font-weight: 500;
		}
	}
}

.info-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 30rpx;
	margin-bottom: 40rpx;
}

.info-item {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: 24rpx;
	background-color: #f8f8f8;
	border-radius: 16rpx;
	
	.info-label {
		font-size: 24rpx;
		color: #666;
		margin: 8rpx 0;
	}
	
	.info-value {
		font-size: 28rpx;
		color: #333;
		font-weight: 500;
	}
}

.introduction-section {
	background-color: #f8f8f8;
	border-radius: 16rpx;
	padding: 24rpx;
	margin-bottom: 40rpx;

	.section-header {
		display: flex;
		align-items: center;
		gap: 12rpx;
		margin-bottom: 20rpx;

		.section-title {
			font-size: 28rpx;
			color: #333;
			font-weight: 500;
		}
	}

	.introduction-content {
		.introduction-text {
			font-size: 28rpx;
			color: #666;
			line-height: 1.6;
		}
	}
}

.action-buttons {
	margin-top: 40rpx;
	padding: 0 20rpx;
	
	:deep(.u-button) {
		height: 88rpx;
		font-size: 32rpx;
	}
}
</style>